<%@ page language="java" contentType="text/html; charset=UTF-8"
         pageEncoding="UTF-8" %>
<!DOCTYPE html>
<html lang="en">
<head>
    <%
        String path = request.getContextPath();
        String basePath = request.getScheme() + "://"
                + request.getServerName() + ":" + request.getServerPort()
                + path + "/";
    %>
    <meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1"/>
    <meta charset="utf-8"/>
    <title>YOOUCE 补丁升级工具</title>

    <meta name="description" content="overview &amp; stats"/>
    <meta name="viewport" content="width=device-width, initial-scale=1.0, maximum-scale=1.0"/>

    <!-- bootstrap & fontawesome -->
    <link rel="stylesheet" href="assets/css/bootstrap.min.css"/>
    <link rel="stylesheet" href="assets/css/font-awesome.min.css"/>

    <!-- page specific plugin styles -->

    <!-- text fonts -->
    <link rel="stylesheet" href="assets/css/ace-fonts.css"/>

    <!-- ace styles -->
    <link rel="stylesheet" href="assets/css/ace.min.css" id="main-ace-style"/>

    <link rel="stylesheet" href="assets/css/ace-skins.min.css"/>
    <link rel="stylesheet" href="assets/css/ace-rtl.min.css"/>


    <!-- ace settings handler -->
    <script src="assets/js/ace-extra.min.js"></script>
    <script src="assets/js/jquery-1.10.2.min.js"></script>

    <script src="assets/js/bootstrap.min.js"></script>

    <!-- page specific plugin scripts -->
    <script src="assets/js/fuelux/fuelux.wizard.min.js"></script>
    <script src="assets/js/jquery.validate.min.js"></script>
    <script src="assets/js/additional-methods.min.js"></script>
    <script src="assets/js/bootbox.min.js"></script>
    <script src="assets/js/jquery.maskedinput.min.js"></script>
    <script src="assets/js/select2.min.js"></script>

    <!-- ace scripts -->
    <script src="assets/js/ace-elements.min.js"></script>
    <script src="assets/js/ace.min.js"></script>
    <script src="assets/ajaxfileupload.js"/>
    <script src="assets/js/ace-extra.min.js"></script>
    <!-- 弹出层样式 -->
    <link rel="stylesheet" href="assets/main.css"/>
</head>

<body>
<div class="main-container" id="main-container">
    <script type="text/javascript">
        try {
            ace.settings.check('main-container', 'fixed')
        } catch (e) {
        }
    </script>

    <div class="main-content">


        <div class="page-content">


            <div class="page-content-area">


                <div class="row">
                    <div class="col-xs-12">


                        <div class="widget-box">


                            <div class="widget-body">
                                <div class="widget-main">
                                    <form class="form-horizontal" id="uploadFileForm" enctype="multipart/form-data"
                                          method="post" action="/uploadPatchFile">

                                        <h3 class="lighter block green">设置服务器信息</h3>


                                        <!-- #section:elements.form.input-state -->
                                        <div class="form-group has-warning">
                                            <label class="col-xs-12 col-sm-3 control-label no-padding-right">服务器IP</label>

                                            <div class="col-xs-12 col-sm-5">
																<span class="block input-icon input-icon-right">
																	<input type="text" name="serverIp"
                                                                           value="192.168.1.138" class="width-100"/>
																	<i class="ace-icon fa fa-leaf"></i>
																</span>
                                            </div>
                                        </div>

                                        <!-- /section:elements.form.input-state -->
                                        <div class="form-group has-error">
                                            <label class="col-xs-12 col-sm-3 col-md-3 control-label no-padding-right">用户名</label>

                                            <div class="col-xs-12 col-sm-5">
																<span class="block input-icon input-icon-right">
																	<input type="text" name="serverUserName"
                                                                           value="administrator" class="width-100"/>
																	<i class="ace-icon fa fa-leaf"></i>
																</span>
                                            </div>
                                        </div>

                                        <div class="form-group has-success">
                                            <label class="col-xs-12 col-sm-3 control-label no-padding-right">密码</label>

                                            <div class="col-xs-12 col-sm-5">
																<span class="block input-icon input-icon-right">
																	<input type="password" name="serverPassword"
                                                                           value="key4054826" class="width-100"/>
																	<i class="ace-icon fa fa-info-circle"></i>
																</span>
                                            </div>
                                        </div>

                                        <div class="form-group has-info">
                                            <label class="col-xs-12 col-sm-3 control-label no-padding-right">工程目录</label>

                                            <div class="col-xs-12 col-sm-5">
																<span class="block input-icon input-icon-right">
																	<input type="text" name="contextPath"
                                                                           value="/home/adminidtrator/test"
                                                                           class="width-100"/>
																	<i class="ace-icon fa fa-info-circle"></i>
																</span>
                                            </div>
                                        </div>






                                        <h3 class="lighter block green">上传补丁文件</h3>


                                        <div id="newUpload">
                                            <div id="newUploadInput">
                                                <label>补丁文件</label><input name="uploadFile" type="file"/>
                                                <label>补丁说明</label><textarea id="instruction" name="instruction"
                                                                             rows="10" cols="100"></textarea>
                                            </div>

                                            <input type="submit" value="上传">
                                        </div>
                                    </form>
                                </div>
                                <!-- /.widget-main -->
                            </div>
                            <!-- /.widget-body -->
                        </div>


                    </div>
                    <!-- /.col -->
                </div>
                <!-- /.row -->
            </div>
            <!-- /.page-content-area -->
        </div>
        <!-- /.page-content -->
    </div>
    <!-- /.main-content -->


</div>


</body>

<script type="text/javascript">

    $(function () {
        //数据表单提交
        $("#uploadFileForm").submit(function () {
            if (validation()) {
                $("#uploadFileForm").submit();
            } else {
                return false;
            }
        });
    });

    /**
     * 表单数据校验
     */
    function validation() {
        //校验内容区标题是否为空
        if ($("input[name='uploadFile']").val() == '') {
            alert("请选择补丁文件!");
            return false;
        }
        if ($('#instruction').val() == '') {
            alert("请输入补丁说明!");
            return false;
        }

        return true;
    }

    iframeHeight();
    //iframe 父窗体自适应高度
    function iframeHeight() {
        var ifm = window.parent.document.getElementById("mainFrame");
        if (ifm != null) {
            ifm.height = $("body").height();
        }
    }
</script>
